package io.renren.modules.app.service.impl;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.app.service.TUserService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.zheok.testing.dao.TUserDao;
import com.zheok.testing.entity.TUserEntity;
import org.springframework.util.StringUtils;


@Service("tuserService")
public class TUserServiceImpl extends ServiceImpl<TUserDao, TUserEntity> implements TUserService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<TUserEntity> wrapper = new QueryWrapper<>();
        String key = (String) params.get("key");

        if(!StringUtils.isEmpty(key)){
            wrapper.lambda().like(TUserEntity::getPhone,key);
        }
        IPage<TUserEntity> page = this.page(
                new Query<TUserEntity>().getPage(params),
                wrapper

        );
        return new PageUtils(page);
    }

}